arch/sh: Check for kprobe trap number before trying to handle a kprobe trap
authorMichael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Wed, 12 Jun 2019 13:08:37 +0000 (15:08 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 21 Aug 2019 12:48:11 +0000 (13:48 +0100)
commitd90026c089e8f8e0f3592807a3a585aec4a88b7d
tree58b048a7c308171aea669b56bef2bc9219f89ec5
parent0c79735b453f4cdebcb33ec4a481bbed369df1a1
arch/sh: Check for kprobe trap number before trying to handle a kprobe trap

The DIE_TRAP notifier chain is run both for kprobe traps and for BUG/WARN
traps. The kprobe code assumes to be only called for
BREAKPOINT_INSTRUCTION, and concludes to have hit a concurrently removed
kprobe if it finds anything else at the faulting locations. This includes
TRAPA_BUG_OPCODE used for BUG and WARN.

The consequence is that kprobe_handler returns 1. This makes
kprobe_exceptions_notify return NOTIFY_STOP, and prevents handling the BUG
statement. This also prevents moving $pc away from the trap instruction,
so the system locks up in an endless loop

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
Gbp-Pq: Topic bugfix/sh
Gbp-Pq: Name sh-check-for-kprobe-trap-number-before-trying-to-handle-a-kprobe-trap.patch
arch/sh/kernel/kprobes.c